/**
 * @author: Loy-winters1224@163.com
 * @date: 2014-9-4-下午5:02:15
 */
package net.loyintean.pearlshell.task.orientedgraph.task;

import java.util.LinkedList;
import java.util.List;

/**
 * a model about configurations of TaskNode.
 * 
 * @author Loy-winters1224@163.com
 * @version 2014-9-4.1.0.0
 */
public final class TaskConfig {

	/**
	 * name of the task.
	 * 
	 */
	private String name;

	/**
	 * the task is from these task.
	 * 
	 */
	private List<String> from = new LinkedList<String>();

	/**
	 * 
	 * @author Loy-winters1224@163.com
	 */
	private TaskConfig() {
		super();
	}

	/**
	 * 
	 * @author Loy-winters1224@163.com
	 */
	private TaskConfig(String n) {
		super();
		this.name = n;
	}

	public static final TaskConfig newConfig() {
		return new TaskConfig();
	}

	public static final TaskConfig newConfig(String n) {
		return new TaskConfig(n);
	}

	/**
	 * set {@link #name(String)} by param.
	 * 
	 * @param n
	 *            the name to indecate.
	 * @return this instance.
	 */
	public final TaskConfig name(String n) {
		this.name = n;
		return this;
	}

	/**
	 * add param into {@link #from}.
	 * 
	 * @param f
	 *            one task of this task's from.
	 * @return this instance.
	 */
	public final TaskConfig from(String f) {
		this.from.add(f);
		return this;
	}

	/**
	 * @return the {@link #name }
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the {@link #from }
	 */
	public List<String> getFrom() {
		return from;
	}

}
